<?php
class Model_AdminAcl extends Zend_Acl{
	public function __construct(){
		$this->addRole(new Zend_Acl_Role('guests'));
		$this->addrole(new Zend_Acl_Role("3"),"guests");
		$this->addRole(new Zend_Acl_Role('2'),'3');
		$this->addRole(new Zend_Acl_Role('1'),'2');
		
		$this->addResource("admin")
			->addResource("admin:index")
			->addResource("admin:news")
			->addResource("admin:advertisement")
			->addResource("admin:menu")
			->addResource("admin:category")
			->addResource("admin:libphoto")
			->addResource("admin:libvideo")
			->addResource("admin:photo")
			->addResource("admin:video")
			->addResource("admin:event")
			->addResource("admin:user")
			->addResource("admin:partner")
			->addResource("admin:contact");
		
		$this->allow("guests","admin:index","login");
		$this->deny("2","admin:index","login");
		$this->allow("2","admin:index",array("index","library","communication","danhmuc"));
		$this->allow("1","admin:news",array("index","add","edit","del","active"));
		$this->allow("1","admin:advertisement",array("index","add","edit","del","active"));
		$this->allow("1","admin:menu",array("index","add","edit","del","active"));
		$this->allow("1","admin:category",array("index","add","edit","del","active"));
		$this->allow("1","admin:libphoto",array("index","add","edit","del","active"));
		$this->allow("1","admin:photo",array("index","add","edit","del","active"));
		$this->allow("1","admin:libvideo",array("index","add","edit","del","active"));
		$this->allow("1","admin:video",array("index","add","edit","del","active"));
		$this->allow("1","admin:event",array("index","add","edit","del","active"));
		$this->allow("1","admin:user",array("index","add","edit","del","active"));
		$this->allow("1","admin:partner",array("index","add","edit","del","active"));
		$this->allow("1","admin:contact",array("index","add","edit","del","active"));
		
		$this->addResource("default")
			->addResource("default:index")
			->addResource("default:advertisement")
			->addResource("default:contact")
			->addResource("default:introduction")
			->addResource("default:knowledge")
			->addResource("default:news")
			->addResource("default:recruitment")
			->addResource("default:service");
		$this->allow("guests","default:index","index");
		$this->allow("guests","default:advertisement","index");
		$this->allow("guests","default:contact","index");
		$this->allow("guests","default:introduction",array("index","showintro"));
		$this->allow("guests","default:knowledge",array("index"));
		$this->allow("guests","default:news",array("index","shownews"));
		$this->allow("guests","default:recruitment","index");
		$this->allow("guests","default:service",array("index","designweb","facebookservice","sms","adver","domain","soft","shownews"));
		$this->allow("guests","default:index","login");
		$this->deny("3","default:index","login");
		$this->allow("3","default:index","logout");
	}
}